cmake_minimum_required (VERSION 2.4)
project (overwatch)

include (CheckIncludeFile)
include (CheckFunctionExists)
include (CheckSymbolExists)

check_include_file ("sys/queue.h" HAS_SYS_QUEUE_H)
check_function_exists (strlcpy HAS_STRLCPY)
check_function_exists (strtonum HAS_STRTONUM)
check_symbol_exists (SIGINFO "signal.h" HAS_SIGINFO)

if (NOT HAS_STRLCPY)
	set (ADD_OBJECTS ${ADD_OBJECTS} "${PROJECT_SOURCE_DIR}/compat/strlcpy.c")
endif (NOT HAS_STRLCPY)

if (NOT HAS_STRTONUM)
	set (ADD_OBJECTS ${ADD_OBJECTS} "${PROJECT_SOURCE_DIR}/compat/strtonum.c")
endif (NOT HAS_STRTONUM)

add_definitions (-DUSING_CMAKE)

add_subdirectory ("owlogmon")

configure_file ("${PROJECT_SOURCE_DIR}/config.h.in"
    "${PROJECT_SOURCE_DIR}/config.h")
